import cv2

cv2.namedWindow('img', cv2.WINDOW_NORMAL)
img = cv2.imread('img/test.jpg')

# cv2.waitKey(0)

while True:
    cv2.imshow('img', img)
    # 窗口接受鼠标键盘事件
    key = cv2.waitKey(0)
    # 监听键盘值
    if (key & 0xFF == ord('q')):
        break
    elif (key & 0xFF == ord('s')):
        cv2.imwrite('img/123.png', img)
    else:
        print(key)
cv2.destroyAllWindows()
# 销毁窗口
